#makefile for applications
#
#usually run on top of net-x platform

CC		= gcc
CFLAGS		= -Wall
LIBS		= -lm -lpthread
DEFS		= 
DIR_COMMON	= common/
OBJECTS_COMMON	= $(DIR_COMMON)config.o $(DIR_COMMON)talk.o $(DIR_COMMON)multicast.o $(DIR_COMMON)multicast_test.o
OUTPUT_BIN	= bin/

COMMON_NAME	= illireg

FLOCKING_NAME		= flocking
DIR_FLOCKING		= $(FLOCKING_NAME)/
OBJECTS_FLOCKING	= $(DIR_FLOCKING)$(FLOCKING_NAME).o
OBJECTS_CLOCKSYNC	= $(DIR_FLOCKING)clocksync.o
OBJECTS_BULLYALGO       = $(DIR_FLOCKING)bullyalgo.o
OBJECTS_LISTEN		= $(DIR_FLOCKING)listen.o
OBJECTS_LOG		= $(DIR_FLOCKING)clock_log.o
OBJECTS_ILLIREG		= $(OBJECTS_COMMON) $(OBJECTS_FLOCKING) $(OBJECTS_LISTEN) $(OBJECTS_CLOCKSYNC) $(OBJECTS_BULLYALGO) $(DIR_COMMON)illireg.o

OBJECTS_CLKLOG		= $(OBJECTS_COMMON) $(OBJECTS_LOG)
		
illireg:	$(OBJECTS_ILLIREG)
		$(CC) $(CFLAGS) $(LIBS) $(OBJECTS_ILLIREG) -o $(OUTPUT_BIN)$(COMMON_NAME)

log:		$(OBJECTS_CLKLOG)
		$(CC) $(CFLAGS) $(LIBS) $(OBJECTS_CLKLOG) -o $(OUTPUT_BIN)clock_log

clean:
		-rm -f $(OUTPUT_BIN)$(COMMON_NAME) $(OUTPUT_BIN)clock_log $(DIR_COMMON)*.o $(DIR_FLOCKING)*.o

